From d4e4e3abeece01a68cb3580be6655b267d721733 Mon Sep 17 00:00:00 2001 From: "shand@ubuntu.eng.hq.xensource.com" Date: Mon, 29 Aug 2005 19:20:55 -0800 Subject: [PATCH] Fix save/restore (for SMP guests in particularl); the blkfront suspend code was failing to unbind its irq handler correctly which (on SMP) caused the guest to BUG() on resume when trying to request its callfunc_irq. Plus a few small cosmetic changes. Signed-off-by: Steven Hand /bin/bash: :x: command not found --- linux-2.6-xen-sparse/arch/xen/kernel/reboot.c | 8 ++------ linux-2.6-xen-sparse/drivers/xen/blkfront/blkfront.c | 2 +- tools/libxc/xc_linux_restore.c | 8 +++++--- 3 files changed, 8 insertions(+), 10 deletions(-) diff --git a/linux-2.6-xen-sparse/arch/xen/kernel/reboot.c b/linux-2.6-xen-sparse/arch/xen/kernel/reboot.c index 9085609dc0..82448a527e 100644 --- a/linux-2.6-xen-sparse/arch/xen/kernel/reboot.c +++ b/linux-2.6-xen-sparse/arch/xen/kernel/reboot.c @@ -65,17 +65,12 @@ static int shutting_down = SHUTDOWN_INVALID; #define cpu_up(x) (-EOPNOTSUPP) #endif -#ifdef CONFIG_SMP -#endif static int __do_suspend(void *ignore) { int i, j; suspend_record_t *suspend_record; - /* Hmmm... a cleaner interface to suspend/resume blkdevs would be nice. */ - /* XXX SMH: yes it would :-( */ - #ifdef CONFIG_XEN_USB_FRONTEND extern void usbif_resume(); #else @@ -108,7 +103,8 @@ static int __do_suspend(void *ignore) #if defined(CONFIG_SMP) && !defined(CONFIG_HOTPLUG_CPU) if (num_online_cpus() > 1) { - printk(KERN_WARNING "Can't suspend SMP guests without CONFIG_HOTPLUG_CPU\n"); + printk(KERN_WARNING + "Can't suspend SMP guests without CONFIG_HOTPLUG_CPU\n"); return -EOPNOTSUPP; } #endif diff --git a/linux-2.6-xen-sparse/drivers/xen/blkfront/blkfront.c b/linux-2.6-xen-sparse/drivers/xen/blkfront/blkfront.c index cd6c341d14..d3caf467c8 100644 --- a/linux-2.6-xen-sparse/drivers/xen/blkfront/blkfront.c +++ b/linux-2.6-xen-sparse/drivers/xen/blkfront/blkfront.c @@ -368,7 +368,7 @@ static void blkif_free(struct blkfront_info *info) free_page((unsigned long)info->ring.sring); info->ring.sring = NULL; } - unbind_evtchn_from_irqhandler(info->evtchn, NULL); + unbind_evtchn_from_irqhandler(info->evtchn, info); info->evtchn = 0; } diff --git a/tools/libxc/xc_linux_restore.c b/tools/libxc/xc_linux_restore.c index 4a9342c347..8d9790e689 100644 --- a/tools/libxc/xc_linux_restore.c +++ b/tools/libxc/xc_linux_restore.c @@ -19,13 +19,13 @@ #define DEBUG 0 #if 1 -#define ERR(_f, _a...) fprintf ( stderr, _f , ## _a ); fflush(stderr) +#define ERR(_f, _a...) do { fprintf ( stderr, _f , ## _a ); fflush(stderr); } while(0) #else #define ERR(_f, _a...) ((void)0) #endif #if DEBUG -#define DPRINTF(_f, _a...) fprintf ( stdout, _f , ## _a ); fflush(stdout) +#define DPRINTF(_f, _a...) do { fprintf ( stdout, _f , ## _a ); fflush(stdout); } while (0) #else #define DPRINTF(_f, _a...) ((void)0) #endif @@ -103,7 +103,7 @@ int xc_linux_restore(int xc_handle, int io_fd, u32 dom, unsigned long nr_pfns, struct mmuext_op pin[MAX_PIN_BATCH]; unsigned int nr_pins = 0; - DPRINTF("xc_linux_restore start\n"); + DPRINTF("xc_linux_restore start: nr_pfns = %lx\n", nr_pfns); if (mlock(&ctxt, sizeof(ctxt))) { /* needed for when we do the build dom0 op, @@ -152,6 +152,8 @@ int xc_linux_restore(int xc_handle, int io_fd, u32 dom, unsigned long nr_pfns, err = xc_domain_memory_increase_reservation(xc_handle, dom, nr_pfns * PAGE_SIZE / 1024); if (err != 0) { + ERR("Failed to increate reservation by %lx\n", + nr_pfns * PAGE_SIZE / 1024); errno = ENOMEM; goto out; } -- 2.30.2